package com.falcon.domain.req;

import com.falcon.mvc.domain.AbsBaseQuery;
import com.swan.mybatis.anno.Table;
import com.swan.mybatis.condition.Condition;
import com.swan.mybatis.condition.OpType;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.FieldNameConstants;

/** 数据库表信息
 * @author zongf
 * @since 2019-11-30
 */
@Table(name = "information_schema.tables")
@Setter @Getter
@FieldNameConstants
public class MysqlTableQuery extends AbsBaseQuery {

    private String tableSchema;

    private String tableName;

    // 注释
    private String tableComment;

    @Override
    public Condition toCondition() {
        Condition condition = Condition.newInstance()
                .and(Fields.tableSchema, OpType.equals, this.tableSchema)
                .and(Fields.tableName, OpType.like, this.tableName)
                .and(Fields.tableComment, OpType.like, this.tableComment);

        return condition;
    }
}
